<el-dialog :close-on-click-modal="false"  :close-on-press-escape="false"  class="dialogStyleBase" :title="mixinEdit_editTitle" width="75%" :visible.sync="mixinEdit_editVisible"
    :before-close="function(){mixinEdit_editBoxClose('editForm')}" append-to-body>
    <div class="dialogStyleBaseBox" v-loading="mixinEdit_loading">
        <el-form ref="editForm" :model="form" label-width="110px" label-position="left">
            <LayoutCell  v-if="next_type == 0">
                <div style="padding: 20px 35px;">
                    <el-form-item label="活动对象">
                        <el-radio-group v-model="form.active_object" :disabled="mixinEdit_editType == 'update'">
                            <el-radio :label="1">全部会员</el-radio>
                        </el-radio-group>
                    </el-form-item>
                    <el-form-item label="活动商品">
                        <SelectDataGoods v-model="goodsIds" :appWindow="appWindow" :count="1" :disabled="mixinEdit_editType == 'update'" 
                            :apiConfig="$vFN.Tools.getAppGlobalData('componentsApiConfig.SelectDataGoods',appWindow)" :showDelete="mixinEdit_editType != 'update'">
                        </SelectDataGoods>
                    </el-form-item>
                    <el-form-item label="活动标题" :rules="{ required: true, message: '活动标题 不能为空'}" prop="title">
                        <el-input v-model="form.title"></el-input>
                    </el-form-item>


                    <el-form-item label="拼团时间" :rules="{ required: true, message: '开始时间 不能为空'}" prop="value">
                        <el-date-picker :disabled="mixinEdit_editType == 'update'"
                            v-model="form.value"
                            type="datetimerange"
                            range-separator="至"
                            start-placeholder="开始时间"
                            end-placeholder="结束时间">
                        </el-date-picker>
                    </el-form-item>
                    

                    <el-form-item label="拼团层级" prop="active_level" :rules="{ required: true, message: '拼团层级 不能为空'}">
                        <div class="activitylevel">
                            <div class="li">
                                <div class="level_id">层级</div>
                                <div class="input_style">
                                    拼团人数
                                </div>
                                <div class="input_style">
                                    拼团时间(团长开团后，有多少小时可以召集团员参团购买)
                                </div>
                                <div class="input_style_end">
                                    操作
                                </div>
                            </div>
                            <div class="li" v-for="(item,index) in form.active_level">
                                <div class="level_id">{{ index + 1 }}</div>
                                <div class="input_style">
                                    <el-input type="number" v-model.number="item.member_number" :disabled="mixinEdit_editType == 'update'"><template slot="append">人</template>
                                    </el-input>
                                </div>
                                <div class="input_style">
                                    <el-input-number style="width: 100%;" v-model.number="item.active_time" :min="1" :disabled="mixinEdit_editType == 'update'"></el-input-number>
                                </div>
                                <div class="input_style_end">
                                    <el-button type="danger" @click="delLevel(item, index)" :disabled="mixinEdit_editType == 'update'">删除</el-button>
                                </div>
                            </div>
                        </div>
                        <el-button @click="addLevel()" style="margin-top: 10px;" :disabled="mixinEdit_editType == 'update'">新增一个拼团层级</el-button>
                        <span class="level_color"> 最多可设置3个阶梯</span>
                    </el-form-item>

                    <el-form-item label="展示设置" prop="hide_number" :rules="{ required: true, message: '展示设置 不能为空'}">
                        <span>当可参的团数达到 </span><el-input style="width: 100px;" v-model.number="form.hide_number" :disabled="mixinEdit_editType == 'update'"></el-input><span> 时，不能开团</span>
                    </el-form-item>
                    <el-form-item label="参团设置" prop="join_number" :rules="{ required: true, message: '参团设置 不能为空'}">
                        <el-input v-model="form.join_number" :disabled="mixinEdit_editType == 'update'" style="width: 200px;"></el-input><span class="level_color">每人最多参加几次不同的团</span> 
                    </el-form-item>

                    <el-form-item label="团长福利">
                        <div v-for="(item,index) in form.team_leader_award">
                            <el-checkbox v-model="item.status" :label="item.describe" true-label="1" false-label="0" style="margin-bottom: 20px;">
                                <span style="display: inline-block;width:100px">{{ item.describe }}</span>
                            </el-checkbox>
                            <el-input type="number" :min="0" v-model="item.award" class="w300" v-if="item.status == 1 && item.type == 'text'"><template slot="prepend">送</template><template slot="append">{{ item.describe }}</template></el-input> 
                            <span class="w300" v-if="item.status == 1 && item.type == 'select'">
                                <SelectDataCoupon :appWindow="appWindow" v-model="couponsIds"></SelectDataCoupon>
                            </span> 
                        </div>
                    </el-form-item>

                    


                    <el-form-item label="购买须知" prop="note" :rules="{ required: true, message: '购买须知 不能为空'}">
                        <el-input v-model="form.note" ></el-input>
                    </el-form-item>
                    <el-form-item label="活动描述" prop="active_describe">
                        <el-input v-model="form.active_describe"></el-input>
                    </el-form-item>

                    
                </div>
            </LayoutCell>

            <LayoutCell v-if="next_type == 1">
                <div>
                    <el-table :data="form.sku" border :ref="mixinPage_vueName+'TableSmall'" style="width: 100%;"
                        @selection-change="mixinTable_handleSelectionChangeTableSmall">
                            <el-table-column prop="product_sku_name" align="center" label="规格" v-if="mixinEdit_editType == 'update'">
                            </el-table-column>
                            <el-table-column align="center" label="规格" v-if="mixinEdit_editType == 'add'">
                                <template slot-scope="scope">
                                    <div v-if="product.length > 1">多规格</div>
                                    <div v-if="product.length == 1">单规格</div>
                                </template>
                            </el-table-column>
                            <el-table-column align="center" label="拼团价格">
                                <template slot-scope="scope">
                                    <div v-for="(item, index) in scope.row.level" style="margin-bottom: 5px">
                                        <el-input v-model="item.active_price"><template slot="prepend"><span v-if="form.active_level[index].member_number">{{ form.active_level[index].member_number }}</span> 人团:</template><template slot="append">元</template></el-input>
                                    </div>
                                </template>
                            </el-table-column>
                            <el-table-column align="center" label="库存" v-if="mixinEdit_editType == 'add'">
                                <template slot-scope="scope">
                                    {{ product[scope.$index].stock }}
                                </template>
                            </el-table-column>
                            <el-table-column prop="stock" align="center" label="活动库存" v-if="mixinEdit_editType == 'update'">
                            </el-table-column>
                            <el-table-column prop="buy_limit" align="center" label="限购件数(0为不限购)">
                                <template slot-scope="scope">
                                    <el-input v-model="scope.row.buy_limit"></el-input>
                                </template>
                            </el-table-column>
                        </el-table>
                </div>
            </LayoutCell>
        </el-form>
    </div>
    <div slot="footer">
        <el-row>
            <el-col :span="12" style="text-align: left;">
                <el-button @click="mixinEdit_editBoxClose('editForm')">取 消</el-button>
            </el-col>
            <el-col :span="12">
                <el-button type="primary" @click="nextStep({model:'form',ref:'editForm'})" v-show="next_type == 0">下一步</el-button>

                <el-button type="primary" @click="lastStep()" v-show="next_type == 1">上一步</el-button>
                <el-button @click="mixinEdit_editFormSubmit({model:'form',ref:'editForm'})" v-if="next_type == 1">保存</el-button>
            </el-col>
        </el-row>
    </div>
</el-dialog>